import { Row } from "antd";
import http from "./fetchHttp";

// 场景渲染全部
export function scree(data) {
  return http({
    url: '/scene/getScenario',
    method: 'get'
  })
}
// 搜索渲染全部
export function searc(data) {
  return http({
    url: '/scene/getSearc',
    method: 'get'
  })
}
// 商品统计渲染
export function comm(data) {
  return http({
    url: '/scene/getcom',
    method: 'get'
  })
}
// 财务统计渲染
export function prince(data) {
  return http({
    url: '/scene/getprin',
    method: 'get'
  })
}
// 场景删除
export function delcj(data) {
  return http({
    url: '/scene/delScenario',
    method: 'post',
    data: {
      SceneId: data.SceneId
    }
  })
}
// 搜索删除
export function delsearc(data) {
  return http({
    url: '/scene/delSearchinfo',
    method: 'post',
    data: {
      seriaId: data.seriaId
    }
  })
}
// 场景查询
export function getcx(data) {
  console.log(data, 'aaa');
  return http({
    url: '/scene/getSceneId',
    method: 'get',
    data: data
  })
}
// // 场景添加
export function addsc(myFormData) {
  console.log(myFormData, 'aaa');
 
  return http({
    url: '/scene/addTo',
    method: 'post',
    data: myFormData,
  })
}
// 搜索添加
export function addsearc(myFormData) {
  console.log(myFormData[0], 'aaa');
  let q = myFormData[0];
  let w = myFormData[1];
  console.log(w);
  // w = Boolean(w)
  for (let i = 0; i < myFormData.length; i++) {
    if (myFormData[1] == true) {
      // console.log('进入判断');
      myFormData[1] = 0
    } else {
      myFormData[1] = 1
      // console.log("进入else");
    }
  }

  console.log(myFormData[1]);
  return http({
    url: '/scene/addSearc',
    method: 'post',
    data: {
      n: q,
      n2: myFormData[1],

    }
  })
}
//场景编辑
export function editsc(row) {
  // console.log(row,'11111');
  console.log(row);
  return http({
    url: '/scene/editable',
    method: "post",
    data: {
      row: row
    }
  })

}
//搜索编辑
export function editsearc(row) {
  // console.log(row,'11111');
  console.log(row);
  return http({
    url: '/scene/editsearc',
    method: "post",
    data: {
      row: row
    }
  })

}






//陈玉
//获取所有订单信息
export function getOrderInfo() {
  return http({
    url: "/order/getOrderInfo",
    method: "get",
  });
}
//条件查询
export function searchOrderByKeys(data) {
  return http({
    url: "/order/searchOrderByKeys",
    method: "post",
    data: data,
  });
}
//单/批量------改变状态
export function changeManyState(data) {
  return http({
    url: "/order/changeManyState",
    method: "post",
    data: data,
  });
}
//单/批量------删除
export function delManyOrderInfo(data) {
  return http({
    url: "/order/delManyOrderInfo",
    method: "post",
    data: data,
  });
}
//根据id获取订单信息
export function getOrderById(data) {
  return http({
    url: "/order/getOrderById",
    method: "post",
    data: data,
  });
}
//根据id获取地址信息
export function getAddressById(data) {
  return http({
    url: "/order/getAddressById",
    method: "post",
    data: data,
  });
}
//根据id获取商品信息
export function getProductById(data) {
  return http({
    url: "/order/getProductById",
    method: "post",
    data: data,
  });
}
//查询一级标签信息
export function getClassifyOne () {
  return http({
    url: '/order/getClassifyOne',
    method: 'get',
  })
}
//查询某个一级标签下的子标签

export function getClassifyChild (data) {
  return http({
    url: '/order/getClassifyChild',
    method: 'post',
    data
  })
}
//查询某个二级标签下，已上架的商品
export function getUpProductByLabelId (data) {
  return http({
    url: '/order/getUpProductByLabelId',
    method: 'post',
    data
  })
}
//根据id 查询对应的售后信息
export function getRefundByOrderId (data) {
  return http({
    url: '/order/getRefundByOrderId',
    method: 'post',
    data
  })
}
//获取所有标签

export function getUpClassifyInfo () {
  return http({
    url: '/order/getUpClassifyInfo',
    method: 'get',
  })
}
//获取该用户的收货地址信息
export function getUserShopAddress (data) {
  return http({
    url: '/user/getUserShopAddress',
    method: 'post',
    data
  })
}
//查询所有用户
export function getUerList () {
  return http({
    url: '/user/getUerList',
    method: 'get',
  })
}
//新增订单信息
export function addOrder (data) {
  return http({
    url: '/order/addOrder',
    method: 'post',
    data
  })
}
//---赖世纪------------------------------/

//查询专区
export function Inquire(row) {
  console.log(row);
  return http({
    url: "/stu/Inquire",
    method: "get",
    data: row,
  });
}

//编辑专区
export function editable1(row) {
  // console.log(row,'11111');
  return http({
    url: "/stu/editable",
    method: "post",
    data: {
      row: row,
    },
  });
}

//添加专区
export function addition(row) {
  let zoneName = row.zoneName;
  let zoneTemplate = row.zoneTemplate;
  if (row.zoneShelf == true) {
    row.zoneShelf = 0;
  } else {
    row.zoneShelf = 1;
  }
  const dateStr = row.zoneTimi;
  const date = new Date(dateStr);
  date.setDate(date.getDate() + 1);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, "0");
  const day = String(date.getDate() - 1).padStart(2, "0");
  const formattedDate = `${year}-${month}-${day}`; // "2023-04-10"
  return http({
    url: "/stu/addTo",
    method: "post",
    data: {
      zoneName,
      zoneTemplate,
      zoneShelf: row.zoneShelf,
      zoneTimi: formattedDate,
    },
  });
}

//渲染标签
export function Label (data) {
  return http({
    url: "/stu/getLabel",
    method: "get",
  });
}

//编辑标签
export function compile(data) {
  if (data.classifyParentID == "无") {
    data.classifyParentID = null;
  }
  if (data.classifyType == true) {
    data.classifyType = 0;
  } else {
    data.classifyType = 1;
  }
  return http({
    url: "/stu/compile",
    method: "post",
    data: {
      classifyParentID: data.classifyParentID,
      classifyType: data.classifyType,
      classifyID: data.classifyID,
      classifyName: data.classifyName,
      classifyClass:data.classifyClass
    },
  });
}

//删除标签
export function remove (row) {
  return http({
    url: "/stu/remove",
    method: "post",
    data: {
      classifyID: row.classifyID,
    },
  });
}

//添加标签
export function add(row) {
  console.log(row);
  let classifyParentID = parseInt(row.classifyParentID);

  if (row.classifyType == true) {
    row.classifyType = 0;
  } else {
    row.classifyType = 1;
  }

  return http({
    url: "/stu/add",
    method: "post",
    data: {
      classifyName: row.classifyName,
      classifyParentID,
      classifyType: row.classifyType,
      classifyClass:row.classifyClass
    },
  });
}
export function zoneinfo(data) {
  return http({
    url: "/stu/getZoneinfo",
    method: "get",
  });
}
//删除专区
export function Delete(row) {
  return http({
    url: "/stu/deleteid",
    method: "post",
    data: {
      zoneId: row.zoneId,
    },
  });
}

export function dealsDer() {
  return http({
    url: "/stu/dealsDer",
    method: "get",
  });
}

//商品渲染
export function goods() {
  return http({
    url: "/stu/goods",
    method: "get",
  });
}
//商品添加
export function increase(values) {
 
  return http({
    url: "/stu/increase",
    method: "post",
    data:values ,
  });
}

//删除商品
export function omit(row) {
  return http({
    url: "/stu/omit",
    method: "post",
    data: {
      productID: row.productID,
    },
  });
}

